import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/Login'
import Home from '@/views/Home'
import User from '@/views/user/User'
import Right from '@/views/rights/Right'
import Role from '@/views/rights/Role'
import Categories from '@/views/goods/Categories'
import Goods from '@/views/goods/Goods'
import List from '@/views/goods/GoodList'
import Add from '@/views/goods/AddGood'
import Reports from '@/views/reports/Reports'

Vue.use(Router)
export default new Router({
  routes: [
    {
      name: 'login',
      path: '/login',
      component: Login
    },
    {
      name: 'home',
      path: '/',
      component: Home,
      children: [
        {
          name: 'user',
          path: 'users',
          component: User
        },
        {
          name: 'right',
          path: 'rights',
          component: Right
        },
        {
          name: 'role',
          path: 'roles',
          component: Role
        },
        {
          name: 'categories',
          path: 'categories',
          component: Categories
        },
        {
          name: 'goods',
          path: 'goods',
          component: Goods,
          redirect: 'goods/list',
          children: [
            {
              name: 'list',
              path: 'list',
              component: List
            },
            {
              name: 'add',
              path: 'add',
              component: Add
            }
          ]
        },
        {
          name: 'reports',
          path: 'reports',
          component: Reports
        }
      ]
    }

  ]
})
